import * as Router from 'koa-router';
import get from './controllers/get';
import getQueries from './controllers/getQueries';
import postJson from './controllers/postJson';
import exception from './controllers/exception';
import argException from './controllers/argumentException';

// 通过 /demo 定义此路由集合的初始地址，子路由为相对此地址的路径
const router = new Router({ prefix: '/demo' });

// demo url: http://localhost:6789/demo/get
router.get('/get', get);
// demo url: http://localhost:6789/demo/get-queries/oooo?q1=nimeifu&q2=123
router.get('/get-queries/:routePathParam', getQueries);
// demo url: http://localhost:6789/demo/post-json
router.post('/post-json', postJson);
// demo url: http://localhost:6789/demo/exception
router.get('/exception', exception);
// demo url: http://localhost:6789/demo/arg-exception
router.get('/arg-exception', argException);

export default router;
